home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’97
/
NewsTicker
/
source code
/
InternetConfig
/
ICPPCGlue.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-17
|
18KB
|
764 lines
#include <Types.h>
#include <MixedMode.h>
#include <Components.h>
#include "ICTypes.h"
#include "ICAPI.h"
#include "ICCAPI.h"
#pragma options align=mac68k
enum {
uppCallComponentProcInfo = kPascalStackBased
| RESULT_SIZE(kFourByteCode)
| STACK_ROUTINE_PARAMETER(1, kFourByteCode)
};
pascal ICError ICStart(ICInstance *inst, OSType creator)
{
ICError junk;
ICError err;
long response;
struct {
char flags;
char size;
short what;
//
OSType creator;
//
ICInstance inst;
} start_component_params;
*inst = nil;
if (Gestalt(gestaltComponentMgr, &response) == noErr) {
*inst = (ICInstance) OpenDefaultComponent(internetConfigurationComponentType, internetConfigurationComponentSubType);
};
if (*inst == nil) {
err = badComponentInstance;
} else {
start_component_params.flags = 0;
start_component_params.size = 4;
start_component_params.what = 0x00;
start_component_params.creator = creator;
start_component_params.inst = *inst;
err = CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &start_component_params);
if (err != noErr) {
junk = CloseComponent((ComponentInstance) *inst);
*inst = nil;
};
};
return(err);
}
pascal ICError ICStop(ICInstance inst)
{
ICError err;
ICError err2;
struct {
char flags;
char size;
short what;
//
//
ICInstance inst;
} stop_component_params;
stop_component_params.flags = 0;
stop_component_params.size = 0;
stop_component_params.what = 0x01;
stop_component_params.inst = inst;
err = CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &stop_component_params);
err2 = CloseComponent((ComponentInstance) inst);
if (err == noErr) {
err = err2;
};
return(err);
}
pascal ICError ICFindConfigFile(ICInstance inst, short count, ICDirSpecArrayPtr folders)
{
struct {
char flags;
char size;
short what;
//
ICDirSpecArrayPtr folders;
short count;
//
ICInstance inst;
} find_config_file_params;
find_config_file_params.flags = 0;
find_config_file_params.size = 6;
find_config_file_params.what = 0x02;
find_config_file_params.folders = folders;
find_config_file_params.count = count;
find_config_file_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &find_config_file_params));
}
pascal ICError ICFindUserConfigFile(ICInstance inst, ICDirSpec *where)
{
struct {
char flags;
char size;
short what;
//
ICDirSpec *where;
//
ICInstance inst;
} find_user_config_file_params;
find_user_config_file_params.flags = 0;
find_user_config_file_params.size = 0x04;
find_user_config_file_params.what = 0x0E;
//
find_user_config_file_params.where = where;
//
find_user_config_file_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &find_user_config_file_params));
}
pascal ICError ICSpecifyConfigFile(ICInstance inst, FSSpec *config)
{
struct {
char flags;
char size;
short what;
//
FSSpec *config;
//
ICInstance inst;
} specify_config_file_params;
specify_config_file_params.flags = 0;
specify_config_file_params.size = 4;
specify_config_file_params.what = 0x03;
specify_config_file_params.config = config;
specify_config_file_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &specify_config_file_params));
}
pascal ICError ICGetSeed(ICInstance inst, long *seed)
{
struct {
char flags;
char size;
short what;
//
long *seed;
//
ICInstance inst;
} get_seed_params;
get_seed_params.flags = 0;
get_seed_params.size = 4;
get_seed_params.what = 0x04;
get_seed_params.seed = seed;
get_seed_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_seed_params));
}
pascal ICError ICGetPerm(ICInstance inst, ICPerm *perm)
{
struct {
char flags;
char size;
short what;
//
ICPerm *perm;
//
ICInstance inst;
} get_perm_params;
get_perm_params.flags = 0;
get_perm_params.size = 4;
get_perm_params.what = 0x0D;
get_perm_params.perm = perm;
get_perm_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_perm_params));
}
pascal ICError ICBegin(ICInstance inst, ICPerm perm)
{
struct {
char flags;
char size;
short what;
//
ICPerm perm;
//
ICInstance inst;
} begin_params;
begin_params.flags = 0;
begin_params.size = 2;
begin_params.what = 0x05;
begin_params.perm = perm;
begin_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &begin_params));
}
pascal ICError ICGetPref(ICInstance inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size)
{
struct {
char flags;
char size;
short what;
//
long *psize;
Ptr buf;
ICAttr *attr;
Str255 *key;
//
ICInstance inst;
} get_pref_params;
get_pref_params.flags = 0;
get_pref_params.size = 16;
get_pref_params.what = 0x06;
//
get_pref_params.psize = size;
get_pref_params.buf = buf;
get_pref_params.attr = attr;
get_pref_params.key = (Str255 *) key;
//
get_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_pref_params));
}
pascal ICError ICSetPref(ICInstance inst, ConstStr255Param key, ICAttr attr, Ptr buf, long size)
{
struct {
char flags;
char size;
short what;
//
long psize;
Ptr buf;
ICAttr attr;
Str255 *key;
//
ICInstance inst;
} set_pref_params;
set_pref_params.flags = 0;
set_pref_params.size = 16;
set_pref_params.what = 0x07;
//
set_pref_params.psize = size;
set_pref_params.buf = buf;
set_pref_params.attr = attr;
set_pref_params.key = (Str255 *) key;
//
set_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &set_pref_params));
}
pascal ICError ICGetPrefHandle(ICInstance inst, ConstStr255Param key, ICAttr *attr, Handle *prefh)
{
struct {
char flags;
char size;
short what;
//
Handle *prefh;
ICAttr *attr;
Str255 *key;
//
ICInstance inst;
} get_pref_handle_params;
get_pref_handle_params.flags = 0;
get_pref_handle_params.size = 0x0C;
get_pref_handle_params.what = 0x1A;
//
get_pref_handle_params.prefh = prefh;
get_pref_handle_params.attr = attr;
get_pref_handle_params.key = (Str255 *) key;
//
get_pref_handle_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_pref_handle_params));
}
pascal ICError ICSetPrefHandle(ICInstance inst, ConstStr255Param key, ICAttr attr, Handle prefh)
{
struct {
char flags;
char size;
short what;
//
Handle prefh;
ICAttr attr;
Str255 *key;
//
ICInstance inst;
} set_pref_handle_params;
set_pref_handle_params.flags = 0;
set_pref_handle_params.size = 0x0C;
set_pref_handle_params.what = 0x1B;
//
set_pref_handle_params.prefh = prefh;
set_pref_handle_params.attr = attr;
set_pref_handle_params.key = (Str255 *) key;
//
set_pref_handle_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &set_pref_handle_params));
}
pascal ICError ICCountPref(ICInstance inst, long *count)
{
struct {
char flags;
char size;
short what;
//
long *count;
//
ICInstance inst;
} count_pref_params;
count_pref_params.flags = 0;
count_pref_params.size = 4;
count_pref_params.what = 0x08;
count_pref_params.count = count;
count_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &count_pref_params));
}
pascal ICError ICGetIndPref(ICInstance inst, long n, Str255 key)
{
struct {
char flags;
char size;
short what;
//
StringPtr key;
long n;
//
ICInstance inst;
} get_ind_pref_params;
get_ind_pref_params.flags = 0;
get_ind_pref_params.size = 8;
get_ind_pref_params.what = 0x09;
//
get_ind_pref_params.key = (StringPtr) key;
get_ind_pref_params.n = n;
//
get_ind_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_ind_pref_params));
}
pascal ICError ICDeletePref(ICInstance inst, ConstStr255Param key)
{
struct {
char flags;
char size;
short what;
//
Str255 *key;
//
ICInstance inst;
} delete_pref_params;
delete_pref_params.flags = 0;
delete_pref_params.size = 4;
delete_pref_params.what = 0x0C;
//
delete_pref_params.key = (Str255 *) key;
//
delete_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &delete_pref_params));
}
pascal ICError ICEnd(ICInstance inst)
{
struct {
char flags;
char size;
short what;
//
//
ICInstance inst;
} end_params;
end_params.flags = 0;
end_params.size = 0;
end_params.what = 0x0A;
//
end_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &end_params));
}
pascal ICError ICDefaultFileName(ICInstance inst, Str63 name)
{
struct {
char flags;
char size;
short what;
//
StringPtr name;
//
ICInstance inst;
} default_file_name_params;
default_file_name_params.flags = 0;
default_file_name_params.size = 4;
default_file_name_params.what = 0x0B;
default_file_name_params.name = (StringPtr) name;
default_file_name_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &default_file_name_params));
}
pascal ICError ICGetComponentInstance(ICInstance inst, Ptr *component_inst)
{
*component_inst = inst;
}
pascal ICError ICEditPreferences(ICInstance inst, ConstStr255Param key)
{
struct {
char flags;
char size;
short what;
//
Str255 *key;
//
ICInstance inst;
} edit_preferences_params;
edit_preferences_params.flags = 0;
edit_preferences_params.size = 0x04;
edit_preferences_params.what = 0x0F;
//
edit_preferences_params.key = (Str255 *) key;
//
edit_preferences_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &edit_preferences_params));
}
pascal ICError ICParseURL(ICInstance inst, ConstStr255Param hint, Ptr data, long len, long *selStart, long *selEnd, Handle url)
{
struct {
char flags;
char size;
short what;
//
Handle url;
long *selEnd;
long *selStart;
long len;
Ptr data;
Str255 *hint;
//
ICInstance inst;
} parse_url_params;
parse_url_params.flags = 0;
parse_url_params.size = 0x18;
parse_url_params.what = 0x10;
//
parse_url_params.url = url;
parse_url_params.selEnd = selEnd;
parse_url_params.selStart = selStart;
parse_url_params.len = len;
parse_url_params.data = data;
parse_url_params.hint = (Str255 *) hint;
//
parse_url_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &parse_url_params));
}
pascal ICError ICLaunchURL(ICInstance inst, ConstStr255Param hint, Ptr data, long len, long *selStart, long *selEnd)
{
struct {
char flags;
char size;
short what;
//
long *selEnd;
long *selStart;
long len;
Ptr data;
Str255 *hint;
//
ICInstance inst;
} launch_url_params;
launch_url_params.flags = 0;
launch_url_params.size = 0x14;
launch_url_params.what = 0x11;
//
launch_url_params.selEnd = selEnd;
launch_url_params.selStart = selStart;
launch_url_params.len = len;
launch_url_params.data = data;
launch_url_params.hint = (Str255 *) hint;
//
launch_url_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &launch_url_params));
}
pascal ICError ICMapFilename(ICInstance inst, ConstStr255Param filename, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
Str255 *filename;
//
ICInstance inst;
} map_filename_params;
map_filename_params.flags = 0;
map_filename_params.size = 0x08;
map_filename_params.what = 0x18;
//
map_filename_params.entry = entry;
map_filename_params.filename = (Str255 *) filename;
//
map_filename_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &map_filename_params));
}
pascal ICError ICMapTypeCreator(ICInstance inst, OSType fType, OSType fCreator, ConstStr255Param filename, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
Str255 *filename;
OSType fCreator;
OSType fType;
//
ICInstance inst;
} map_type_creator_params;
map_type_creator_params.flags = 0;
map_type_creator_params.size = 0x10;
map_type_creator_params.what = 0x19;
//
map_type_creator_params.entry = entry;
map_type_creator_params.filename = (Str255 *) filename;
map_type_creator_params.fCreator = fCreator;
map_type_creator_params.fType = fType;
//
map_type_creator_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &map_type_creator_params));
}
pascal ICError ICMapEntriesFilename(ICInstance inst, Handle entries, ConstStr255Param filename, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
Str255 *filename;
Handle entries;
//
ICInstance inst;
} map_entries_filename_params;
map_entries_filename_params.flags = 0;
map_entries_filename_params.size = 0x0C;
map_entries_filename_params.what = 0x1C;
//
map_entries_filename_params.entry = entry;
map_entries_filename_params.filename = (Str255 *) filename;
map_entries_filename_params.entries = entries;
//
map_entries_filename_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &map_entries_filename_params));
}
pascal ICError ICMapEntriesTypeCreator(ICInstance inst, Handle entries, OSType fType, OSType fCreator, ConstStr255Param filename, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
Str255 *filename;
OSType fCreator;
OSType fType;
Handle entries;
//
ICInstance inst;
} map_entries_type_creator_params;
map_entries_type_creator_params.flags = 0;
map_entries_type_creator_params.size = 0x14;
map_entries_type_creator_params.what = 0x1D;
//
map_entries_type_creator_params.entry = entry;
map_entries_type_creator_params.filename = (Str255 *) filename;
map_entries_type_creator_params.fCreator = fCreator;
map_entries_type_creator_params.fType = fType;
map_entries_type_creator_params.entries = entries;
//
map_entries_type_creator_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &map_entries_type_creator_params));
}
pascal ICError ICCountMapEntries(ICInstance inst, Handle entries, long *count)
{
struct {
char flags;
char size;
short what;
//
long *count;
Handle entries;
//
ICInstance inst;
} count_map_entries_params;
count_map_entries_params.flags = 0;
count_map_entries_params.size = 0x08;
count_map_entries_params.what = 0x12;
//
count_map_entries_params.count = count;
count_map_entries_params.entries = entries;
//
count_map_entries_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &count_map_entries_params));
}
pascal ICError ICGetIndMapEntry(ICInstance inst, Handle entries, long ndx, long *pos, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
long *pos;
long ndx;
Handle entries;
//
ICInstance inst;
} get_ind_map_entry;
get_ind_map_entry.flags = 0;
get_ind_map_entry.size = 0x10;
get_ind_map_entry.what = 0x13;
//
get_ind_map_entry.entry = entry;
get_ind_map_entry.pos = pos;
get_ind_map_entry.ndx = ndx;
get_ind_map_entry.entries = entries;
//
get_ind_map_entry.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_ind_map_entry));
}
pascal ICError ICGetMapEntry(ICInstance inst, Handle entries, long pos, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
long pos;
Handle entries;
//
ICInstance inst;
} get_map_entry;
get_map_entry.flags = 0;
get_map_entry.size = 0x0C;
get_map_entry.what = 0x14;
//
get_map_entry.entry = entry;
get_map_entry.pos = pos;
get_map_entry.entries = entries;
//
get_map_entry.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_map_entry));
}
pascal ICError ICSetMapEntry(ICInstance inst, Handle entries, long pos, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
long pos;
Handle entries;
//
ICInstance inst;
} set_map_entry;
set_map_entry.flags = 0;
set_map_entry.size = 0x0C;
set_map_entry.what = 0x15;
//
set_map_entry.entry = entry;
set_map_entry.pos = pos;
set_map_entry.entries = entries;
//
set_map_entry.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &set_map_entry));
}
pascal ICError ICDeleteMapEntry(ICInstance inst, Handle entries, long pos)
{
struct {
char flags;
char size;
short what;
//
long pos;
Handle entries;
//
ICInstance inst;
} delete_map_entry;
delete_map_entry.flags = 0;
delete_map_entry.size = 0x08;
delete_map_entry.what = 0x16;
//
delete_map_entry.pos = pos;
delete_map_entry.entries = entries;
//
delete_map_entry.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &delete_map_entry));
}
pascal ICError ICAddMapEntry(ICInstance inst, Handle entries, ICMapEntry *entry)
{
struct {
char flags;
char size;
short what;
//
ICMapEntry *entry;
Handle entries;
//
ICInstance inst;
} add_map_entry;
add_map_entry.flags = 0;
add_map_entry.size = 0x08;
add_map_entry.what = 0x17;
//
add_map_entry.entry = entry;
add_map_entry.entries = entries;
//
add_map_entry.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &add_map_entry));
}